package com.em.dao;

import com.em.pojo.Emp;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface EmpMapper {
    List<Emp> findAll();
    List<Emp> getEmpByLimit(Map<String,Object> map);

    @Select("select * from emp where id=#{id}")
    Emp getEmpById(Integer id);

    @Update("update emp set salary=#{salary} where name=#{name}")
    int updateSalaryByName(Map<String,Object> map);

    @Update("update emp set salary=#{salary} where id=#{id}")
    int updateSalaryById(@Param("id")int id,@Param("salary")double salary);

    @Insert("insert into emp(id,name,job,salary) values(#{id},#{name},#{job},#{salary})")
    int insertEmp(Emp emp);
}
